Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: partial test files support #9

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

n0izn0iz
Copy link
Contributor

@n0izn0iz n0izn0iz commented Dec 29, 2024

Adds partial support for Test and XTest files.

The biggest missing thing is to support go libs injected in testing likefmt, encoding/json, etc..

There is one regression, injected testing stdlib functions like std.TestSetRealm will not show an error if used in normal .gno files since there is no simple way to use different stdlib sources in normal and test files

This should neverless help to navigate most test sources and help with refactoring by applying symbol renames also in test files

No support for Filetest files

Screenshot 2024-12-29 at 19 23 20

@gfanton
Copy link
Contributor

gfanton commented Jan 7, 2025

The biggest missing thing is to support go libs injected in testing like fmt, encoding/json, etc..

One solution could be to initialize a testing store from gnovm/pkg/tests, and either get all the packages from there or simply try to resolve the package using the store.

@gfanton
Copy link
Contributor

gfanton commented Jan 7, 2025

it doesn't seems to works on my side..

While opening reader_test.go, I got this error from the server:

2025/01/07 14:17:38 code lens test failed: no package metadata for file file:///Users/gfanton/code/gnolang/gno/gnovm/stdlibs/bytes/reader_test.gno

2025/01/07 14:17:38 fixImports(filename="/Users/gfanton/code/gnolang/gno/gnovm/stdlibs/bytes/reader_test.gno"), abs="/Users/gfanton/code/gnolang/gno/gnovm/stdlibs/bytes/reader_test.gno", srcDir="/Users/gfanton/code/gnolang/gno/gnovm/stdlibs/bytes" ...

2025/01/07 14:17:38 no highlight: getting package for Highlight: no package metadata for file file:///Users/gfanton/code/gnolang/gno/gnovm/stdlibs/bytes/reader_test.gno

2025/01/07 14:17:38 code lens test failed: no package metadata for file file:///Users/gfanton/code/gnolang/gno/gnovm/stdlibs/bytes/reader_test.gno

@n0izn0iz
Copy link
Contributor Author

n0izn0iz commented Jan 7, 2025

mmh, there is conflicts when you open stdlibs files due to the testing overlay, I'm not sure how to go about that without modifying some gopls internals
for the record, gopls has multiple problems when you open the golang stdlibs sources

@Kouteki Kouteki requested a review from gfanton January 7, 2025 18:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants